<script src="ADMIN_JS/ajax_file_upload.js" type="text/javascript"></script> 
<script type="text/javascript" src="__STATIC__/js/jquery.ui.widget.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/js/jquery.fileupload.js" charset="utf-8"></script>
<style>
.RIGHT{
	min-height:750px;
}
</style>
<div class="upload-con" id="uploader" style="display:none;overflow:auto;height:350px;width:185px;">    
      <div nctype="file_msg" ></div>
      <div class="upload-pmgressbar" nctype="file_loading"></div>
      <div class="upload-txt"><span>支持Jpg、Png格式，大小不超过1024KB的图片上传；浏览文件时可以按住ctrl或shift键多选。</span> </div>   
</div>
<script type="text/javascript">
$(function() {
    //鼠标触及区域li改变class
  	var album_id = $("#album_id").val();
  	var dataAlbum = {
  			"album_id" : album_id,
  			"type" : "1,2,3,4",
  			'file_path' : UPLOADGOODS
  		};
    // ajax 上传图片
    var upload_num = 0; // 上传图片成功数量
    $('#fileupload').fileupload({
        url: 'ADMIN_MAIN/upload/photoalbumupload',
        dataType: 'json',
        formData:dataAlbum,
        add: function (e,data) {
        	//显示上传图片框
        	if($("#uploader").is(":hidden")){
    			$("#uploader").show();
    		}
        	$.each(data.files, function (index, file) {
                $('<div nctype="' + file.name + '"><p>'+ file.name +'</p><p class="loading"></p></div>').appendTo('div[nctype="file_loading"]');
            });
        	data.submit();    	
        },
        done: function (e,data) {
        	var param = data.result;
            //alert(JSON.stringify(data));
            $this = $('div[nctype="' + param.origin_file_name + '"]');
            $this.fadeOut(3000, function(){
                $(this).remove();
                if ($('div[nctype="file_loading"]').html() == '') {
                	$("#uploader").hide();
                	LoadingInfo(1);
                    //setTimeout("window.location.reload()", 1000);
                }
            });
            if(param.state > 0){
                upload_num++;
                $('div[nctype="file_msg"]').html('<i class="icon-ok-sign">'+'</i>'+'成功上传'+upload_num+'张图片');

            } else {
                $this.find('.loading').html(param.message).removeClass('loading');
            }           
        }
    });

});
</script>